// 引入 request 方法，假设 request 方法已经定义在某个工具文件中
import request from '/@/utils/request';
import {
     AddTemplateInput, 
     BaseIdInput,
    PageTemplateInput,
    ProViewTemplateInput,
    RenderTemplateInput,
    UpdateTemplateInput,
} from '../models';
// 定义 API 路径枚举
enum Api {
    SysTemplateAdd = '/sysTemplate/add',
    SysTemplateDelete = '/sysTemplate/delete',
    SysTemplateGroupList = '/sysTemplate/groupList',
    SysTemplatePage = '/sysTemplate/page',
    SysTemplateProView = '/sysTemplate/proView',
    SysTemplateRender = '/sysTemplate/render',
    SysTemplateTemplateCode = '/sysTemplate/template/{code}',
    SysTemplateUpdate = '/sysTemplate/update',
}

// 定义 API 方法
export const apiSysTemplateAddPost = (body?: AddTemplateInput) =>
    request({
        url: Api.SysTemplateAdd,
        method: 'post',
        data: body,
    });

export const apiSysTemplateDeletePost = (body?: BaseIdInput) =>
    request({
        url: Api.SysTemplateDelete,
        method: 'post',
        data: body,
    });

export const apiSysTemplateGroupListGet = () =>
    request({
        url: Api.SysTemplateGroupList,
        method: 'get',
    });

export const apiSysTemplatePagePost = (body?: PageTemplateInput) =>
    request({
        url: Api.SysTemplatePage,
        method: 'post',
        data: body,
    });

export const apiSysTemplateProViewPost = (body?: ProViewTemplateInput) =>
    request({
        url: Api.SysTemplateProView,
        method: 'post',
        data: body,
    });

export const apiSysTemplateRenderPost = (body?: RenderTemplateInput) =>
    request({
        url: Api.SysTemplateRender,
        method: 'post',
        data: body,
    });

export const apiSysTemplateTemplateCodeGet = (code: string) =>
    request({
        url: Api.SysTemplateTemplateCode.replace('{code}', code),
        method: 'get',
    });

export const apiSysTemplateUpdatePost = (body?: UpdateTemplateInput) =>
    request({
        url: Api.SysTemplateUpdate,
        method: 'post',
        data: body,
    });